<?php include('./templete/public/head.php') ?>

<body>

<!--金点子排行-->
<div class="idea-rank-main">
    <img src="_images/rank-bg.jpg" class="rank-bg"/>
    <div class="rank-content">
        <div class="c-top">
            <a href="<?php echo url('rank', ['type' => 1]) ?>"
               <?php if ($type == 1){ ?>class="active" <?php } ?>>个人榜</a>
            <a href="<?php echo url('rank', ['type' => 2]) ?>"
               <?php if ($type == 2){ ?>class="active" <?php } ?>>部门榜</a>
            <a href="<?php echo url('rank', ['type' => 3]) ?>"
               <?php if ($type == 3){ ?>class="active" <?php } ?>>月度五佳</a>
            <a href="<?php echo url('rank', ['type' => 4]) ?>"
               <?php if ($type == 4){ ?>class="active" <?php } ?>>年度十佳</a>
            <!--
            <a href="<?php //echo url('rank', ['type' => 5]) ?>"
               <?php if ($type == 5){ ?>class="active" <?php } ?>>奖金榜</a>
               -->
        </div>
        <div class="c-bot">
            <div class="mui-slider">
                <div class="mui-control">
                    <?php if (($type == 1) || ($type == 2)) { ?>
                        <div class="top_nav">

                            <a href="<?php echo url('rank', ['type' => $type, 'model' => 1]) ?>"
                               class="<?php if ($model == 1) { ?>mui-active <?php } ?>">
                                <span>提议数量</span>
                            </a>
                            <a href="<?php echo url('rank', ['type' => $type, 'model' => 2]) ?>"
                               class="<?php if ($model == 2) { ?>mui-active <?php } ?>">
                                <span>揭榜次数</span>
                            </a>
                            <a href="<?php echo url('rank', ['type' => $type, 'model' => 3]) ?>"
                               class=" <?php if ($model == 3) { ?>mui-active <?php } ?>">
                                <span>实施次数</span>
                            </a>
                            <a href="<?php echo url('rank', ['type' => $type, 'model' => 4]) ?>"
                               class="<?php if ($model == 4) { ?>mui-active <?php } ?>">
                                <span>累计得分</span>
                            </a>
                        </div>
                    <?php } ?>
                    <div class="mui-slider-group">
                        <!--1-->
                        <div class="mui-slider-item mui-control-content">
                                <ul class="rank-list">
                                    <?php if ($type == 1) { ?>
                                        <?php if ($model != 4) { ?>
                                            <?php foreach ($list as $k => $v) { ?>
                                                <?php if ($v['user_id']) { ?>
                                                    <?php $user_info[$k] = get_user_info($v['user_id']) ?>
                                                    <li class="rank-item">
                                                        <img src="<?php echo $user_info[$k]['avatar'] ?>"
                                                             class="head-img"/>
                                                        <div class="progress" id="progress<?php echo $k ?>">
                                                            <p><?php echo $user_info[$k]['name'] ?>
                                                                <span class="integral"><?php echo $v['count'] ?></span><span>次</span>
                                                            </p>
                                                            <p class="mui-progressbar mui-progressbar-in">
                                                                <span></span>
                                                            </p>
                                                        </div>
                                                    </li>
                                                <?php } ?>
                                            <?php } ?>
                                        <?php } ?>
                                        <?php if ($model == 4) { ?>
                                            <?php foreach ($list as $k => $v) { ?>
                                                <?php if ($v['user_id']) { ?>
                                                    <?php $user_info[$k] = get_user_info($v['user_id']) ?>
                                                    <li class="rank-item">
                                                        <img src="<?php echo $user_info[$k]['avatar'] ?>"
                                                             class="head-img"/>
                                                        <div class="progress" id="progress<?php echo $k ?>">
                                                            <p><?php echo $user_info[$k]['name'] ?>
                                                                <span class="integral"><?php echo $v['integral'] ?></span><span>分</span>
                                                            </p>
                                                            <p class="mui-progressbar mui-progressbar-in">
                                                                <span></span>
                                                            </p>
                                                        </div>
                                                    </li>
                                                <?php } ?>
                                            <?php } ?>
                                        <?php } ?>
                                    <?php } ?>
                                    <?php if ($type == 2) { ?>
                                        <?php if ($model == 1) { ?>
                                            <?php $k = 0; ?>
                                            <?php foreach ($list as $v) { ?>
                                                <?php if ($v['departid']) { ?>
                                                    <li class="rank-item">
                                                        <div class="progress" id="progress<?php echo $k ?>">
                                                            <p><?php echo $v['department'] ?>
                                                                <span class="integral"><?php echo $v['count'] ?></span><span>次</span>
                                                            </p>
                                                            <p class="mui-progressbar mui-progressbar-in">
                                                                <span></span>
                                                            </p>
                                                        </div>
                                                    </li>
                                                    <?php $k++ ?>
                                                <?php } ?>
                                            <?php } ?>
                                        <?php } ?>
                                        <?php if ($model == 2 || $model == 3) { ?>
                                            <?php $k = 0; ?>
                                            <?php foreach ($list as $v) { ?>
                                                <?php if ($v['count'] > 0) { ?>
                                                    <li class="rank-item">
                                                        <div class="progress" id="progress<?php echo $k ?>">
                                                            <p><?php echo $v['name'] ?>
                                                                <span class="integral"><?php echo $v['count'] ?></span><span>次</span>
                                                            </p>
                                                            <p class="mui-progressbar mui-progressbar-in">
                                                                <span></span>
                                                            </p>
                                                        </div>
                                                    </li>
                                                    <?php $k++; ?>
                                                <?php } ?>
                                            <?php } ?>
                                        <?php } ?>
                                        <?php if ($model == 4) { ?>
                                            <?php $k = 0; ?>
                                            <?php foreach ($list as $v) { ?>
                                                <?php if ($v['sum'] > 0) { ?>
                                                    <li class="rank-item">
                                                        <div class="progress" id="progress<?php echo $k ?>">
                                                            <p><?php echo $v['name'] ?>
                                                                <span class="integral"><?php echo $v['sum'] ?></span><span>分</span>
                                                            </p>
                                                            <p class="mui-progressbar mui-progressbar-in">
                                                                <span></span>
                                                            </p>
                                                        </div>
                                                    </li>
                                                    <?php $k++; ?>
                                                <?php } ?>
                                            <?php } ?>
                                        <?php } ?>
                                    <?php } ?>
                                    <?php if ($type == 3 ) { ?>
                                        <?php foreach ($list as $k => $v) { ?>
                                            <?php if ($k < 5) { ?>
                                                <li class="rank-item">
                                                    <img src="<?php echo $v['user_head'] ?>"
                                                         class="head-img"/>
                                                    <div class="progress" id="progress<?php echo $k ?>">
                                                        <p><?php echo $v['user_name'].'-'.$v['title'] ?>
                                                            <span class="integral"><?php echo $v['score']?></span><span>分</span>
                                                        </p>
                                                        <p class="mui-progressbar mui-progressbar-in">
                                                            <span></span>
                                                        </p>
                                                    </div>
                                                </li>
                                            <?php } ?>
                                        <?php } ?>
                                    <?php } ?>
                                    <?php if ($type == 4 ) { ?>
                                        <?php foreach ($list as $k => $v) { ?>
                                            <?php if ($k < 10) { ?>
                                                <li class="rank-item">
                                                    <img src="<?php echo $v['user_head'] ?>"
                                                         class="head-img"/>
                                                    <div class="progress" id="progress<?php echo $k ?>">
                                                        <p><?php echo $v['user_name'].'-'.$v['title'] ?>
                                                            <span class="integral"><?php echo $v['score']?></span><span>分</span>
                                                        </p>
                                                        <p class="mui-progressbar mui-progressbar-in">
                                                            <span></span>
                                                        </p>
                                                    </div>
                                                </li>
                                            <?php } ?>
                                        <?php } ?>
                                    <?php } ?>
                                    <?php if ($type == 5 ) { ?>
                                        <?php foreach ($list as $k => $v) { ?>
                                            <?php if ($k < 10) { ?>
                                                <li class="rank-item">
                                                    <img src="<?php echo get_user_info($v['user_id'])['avatar'] ?>"
                                                         class="head-img"/>
                                                    <div class="progress" id="progress<?php echo $k ?>">
                                                        <p><?php echo $v['user_name']?>
                                                            <span class="integral"><?php echo $v['amount']?></span><span></span>
                                                        </p>
                                                        <p class="mui-progressbar mui-progressbar-in">
                                                            <span></span>
                                                        </p>
                                                    </div>
                                                </li>
                                            <?php } ?>
                                        <?php } ?>
                                    <?php } ?>
                                </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    //进度
    (function () {
        var progressbar1 = $("[id^='progress']");// mui('#progress^');
        var first = $('#progress0').find('.integral').text();
        console.log(first);
        for (var i = 0; i < progressbar1.length; i++) {
            let integral = $('#progress' + i).find('.integral').text();
            mui(progressbar1[i]).progressbar().setProgress(integral * 100 / first)
        }
    })(mui);
    var topheight=$(".rank-list").offset().top;
    var height= $(window).height() - topheight-30;
    $(".mui-slider-group").css("height",height)

</script>

</html>